Component({
    /**
     * 组件的属性列表
     */
    properties: {
      label: String,
      required: Boolean,
      placeholder:String,
      arrow: {
          type: Boolean,
          value: false
      },
      input_type: {
          type: String,
          value: ''
      },
      picker_idx:{
          type: Number,
          value: 0
      },
      picker_key:{
          type: String,
          value: 'name'
      },
      picker_data:{
          type: Array,
          value: []
      },
      region:{
          type: Array,
          value: ['北京市', '', '']//'city','bottom','left'
      },
      picker_date:{
        type: String,
        value: '请选择日期'
      },
      picker_time: {
        type: String,
        value: '请选择时间'
      },
    },

    /**
     * 组件的初始数据
     */
    data: {
        //region: ['北京市', '', ''],
        customItem: '全部',
        picker_idx:0//已选择的索引
    },
    
    /**
     * 组件的方法列表
     */
    methods: {
      bindRegionChange: function (e) {
        var val_arr = e.detail.value;
        if (val_arr[0] == '全部' && val_arr[1] == '全部' && val_arr[2] == '全部'){
          this.setData({
            region: ['请选择地区']
          })
          return;
        }
        this.setData({
            region: e.detail.value
        })
        this.triggerEvent('cellform', {
            region: this.data.region
        });
      },
      bindPickerChange:function(e){
          this.setData({
              picker_idx: e.detail.value
          })
          this.triggerEvent('cellform', {
              picker_idx: this.data.picker_idx
          });
      },
      bindDateChange: function (e) {
        this.setData({
          picker_date: e.detail.value
        })
        this.triggerEvent('cellform', {
          picker_date: this.data.picker_date
        });
      },
      bindTimeChange: function (e) {
        this.setData({
          picker_time: e.detail.value
        })
        this.triggerEvent('cellform', {
          picker_time: this.data.picker_time
        });
      }
    }
})
